<template>
  <div>
    <div style="width: 800px; height: 500px" ref="chart"></div>
  </div>
</template>
<script>
import profilesApi from "@/api/hr/profiles";
const echarts = require("echarts");
let myChart;
export default {
  data() {
    return {
      mydatas: [],
    };
  },

  methods: {
    //在职人数

    async initCharts() {
      await profilesApi.getCountPor().then((response) => {
        this.mydatas = response.data.list;
      });

      myChart = echarts.init(this.$refs.chart);
     
      // 绘制图表
      myChart.setOption({
        title: { text: "会盈员工统计" },
        tooltip: {},
        xAxis: {
          data: ["本月离职", "本月入职", "离职员工", "在职员工"],
        },
        yAxis: {},
        series: [
          {
            name: "人数",
            type: "bar",
            data: this.mydatas,
          },
        ],
      });
    },
  },
  mounted() {
    this.initCharts();
  },
};
</script>